Chapter 8 picGet bare minimum EC2
1. Open EC2
AWS Console → EC2 → Instances → Launch instances
Step 02: Type "ec2" in Search
Step 03: Click link "Launch instance"

Step 04: Instance name
Use any name, for example:
Step 05: Select a Operating System eg. Amazon Linux
Step 07: Key pair
Select Proceed without a key pair (Not recommended).
We will use EC2 Instance Connect to access the instance directly from the AWS Console, so a key pair .pem file is not needed for this setup.

Step 08: Addition of a vpc
A VPC is a private ip address range which identifies your newly created machine inside AWS network using its IP address. One default VPC is already made in AWS and if you accidentally deleted it you can create one using this guide - [[Chapter 4 Making a default vpc]]
Step 09: Attaching/creating a Security Group
This step is common while creating RDS and EC2 both.
A security group tells who in world can connect to this app. Security group has security rules attached to it. Here we are quickly creating one and allowing everyone in world in aws and outside aws to be able to connect to our app. You can use same security group for multiple apps also but for this time we are creating one specific for EC2.

Step 10: (totally optional) Click Edit
you can click edit to change the security rules inside security group. for changing the name of our security group we are editing it but you can keep as it is with a random name


Step 10:(optional) Scroll down and click Additional Details
We are now attaching a IAM role with this EC2 because we want to connect to our machine from AWS SSM manager (cmd inside aws) instead of having a saperate app for it.
for SSM manager we need to attach a IAM role to our EC2 Machine

Step 18: Click Create new IAM profile
This step will create an IAM role (profile)

Step 19: Give a name to your IAM Role

Step 20: Attach Policy
Select option -> to use existing policy and enter ssmmanaged to (search) select this policy. This will let our IAM role to use EC2

Step 25: Click Launch instance

Step 26: Click link "Instances"
Once your instance is launched, go back to see all instances.
Select your instance and click on connect.

After that click SSM session manager -> then click connect (we created IAM profile to connect with SSM session manager)
(Other options will require separate software but SSM session manager will open in browser, its own CMD)

This is how the cmd open now run this sudo command.

Done your EC2 is created and started